

function zhifu(){
	     var val=$('input:radio[name="radio1"]:checked').val();
	     if(val==null){
	     	alert("未选择支付方式");
	     	return false;
	     }else{
//	     	 if(val=="01"){
//	     	/* if(parseFloat($("#zhanghuss").val())>=parseFloat(zongjine)){
//	     	 	   alert("支付输入密码的逻辑");
//	     	 }else{
//              alert("支付失败余额不足");	     	 	
//	     	 }*/
//	     	 	  yuezhifu();
//	     	 }else if(val=="02"){
	     	 	  // alert("微信支付");
	     	 	 // alert("132")
	     	 	 callpay();
	     	// zhifuweixin();
	     	 }
	   }

//微信支付
function  zhifuweixin(){
	var jinge=parseFloat($("#jinge").val());
	if(jinge>=0.1){
	     if(uuuuid!="" ){
	       $.ajax({
					url: urlcore+"/api/pay/wxpay2?recoedType=1&cashMoney="+jinge+"&userId="+uuuuid,
					type: "get",
					dataType: 'json',
					contentType: "application/json;charset=utf-8",
					success:function(data){		
					var d = data.data;
					 WeixinJSBridge.invoke(
					    'getBrandWCPayRequest',
					    {
				           "appId":d.appId,    
				           "timeStamp":d.timeStamp,        
				           "nonceStr":d.nonceStr, 
				           "package":d.package,     
				           "signType":"MD5",        
				           "paySign":d.paySign 
				       },
					    function (res){
					         if(res.err_msg == "get_brand_wcpay_request:ok" ) {
					           // alert("支付成功");
					            window.location.href = document.referrer;
					         }else{
					         	alert("支付失败");
					         }
					    });
				},
					error:function() {
						/* Act on the event */
						alert("error");
					}
				});	
	   }
	     }else{
	     	alert("金额充值条件不成立");
	     }
}


 function callpay(){
		if (typeof WeixinJSBridge == "undefined"){
			    if (document.addEventListener){
		document.addEventListener('WeixinJSBridgeReady', zhifuweixin,false);
			    }else if (document.attachEvent){
        document.attachEvent('WeixinJSBridgeReady', zhifuweixin);
		document.attachEvent('onWeixinJSBridgeReady', zhifuweixin);
			    }
			    }else{
			        zhifuweixin();
			    }
			    
			    
			}
 


